<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Newrequirement_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 * 根据商品ID返回商品备注信息
	 */
	public function find_by_product_date($productid,$date){
		$this->db->select('t_user.shopname as name,t_newrequirement.content');
		$this->db->from('t_newrequirement');
		$this->db->where('t_newrequirement.productid',$productid);
		$this->db->where('t_order.state>=2');
		$this->db->where("DATE_FORMAT(t_order.order_time,'%Y-%m-%d')",$date);
		$this->db->join('t_order', 't_newrequirement.orderid = t_order.id','left');
		$this->db->join('t_user', 't_newrequirement.userid = t_user.id','left');
		$query = $this->db->get();
		return $query->result_array();
	}
}